import java.util.ArrayList;

public class Cal {

    static void calSchool() {
        School school = new School();
        school.stuClasses = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            school.stuClasses.add(mockClass(i));
        }
        double avgClassStuCnt = school.avgClassStuCnt();
        System.out.println("avgClassStuCnt");
        System.out.println(avgClassStuCnt);
    }

    static StuClass mockClass(int classNum) {
        StuClass stuClass = new StuClass();


//        stuClass.clsNum="20190911";
//        stuClass.name="信管191";
        stuClass.clsNum = "2019091" + classNum;
        stuClass.name = "信管19" + classNum;
        stuClass.students = new ArrayList<>();
//        for (int i = 0; i <3 ; i++) {
        for (int i = 0; i < 6; i++) {
            Student student = new Student();
            student.stuNum = "2019090" + i;
            student.name = "好人" + i;
//            student.sex="男人";
            student.sex = Student.MALE;
//            student.birthDate=new Date();
            student.birthYearMonth = "2000-0" + (i + 1);
            stuClass.students.add(student);
        }
        return stuClass;
    }

    static void testOneClass() {
        StuClass stuClass = new StuClass();


        stuClass.clsNum = "20190911";
        stuClass.name = "信管191";
        stuClass.students = new ArrayList<>();
//        for (int i = 0; i <3 ; i++) {
        for (int i = 0; i < 6; i++) {
            Student student = new Student();
            student.stuNum = "2019090" + i;
            student.name = "好人" + i;
//            student.sex="男人";
            student.sex = Student.MALE;
//            student.birthDate=new Date();
            student.birthYearMonth = "2000-0" + (i + 1);
            stuClass.students.add(student);
        }

        double avgAge = stuClass.avgAge();
        System.out.println("avgAge of class : " + stuClass.name);
        System.out.println(avgAge);
//        平均年龄
//        stuClass.

        int cntOfFemale = stuClass.cntOfFemale();
        int cntOfMale = stuClass.cntOfMale();
        System.out.println("cntOfFemale");
        System.out.println(cntOfFemale);

        System.out.println("cntOfMale");
        System.out.println(cntOfMale);
//        输出
//        avgAge of class : 信管191
//        22.0
//        cntOfFemale
//        0
//        cntOfMale
//        6
    }

    public static void main(String[] args) {
        calSchool();
//        第四题
//        avgClassStuCnt
//        6.0
    }
}
